package com.atqh.logistics.controller.LoginController;

import com.atqh.logistics.Aop.LogAnnotation;
import com.atqh.logistics.service.DriverService;
import com.atqh.logistics.service.ManagerService;
import com.atqh.logistics.utils.Result;
import com.atqh.logistics.utils.Vo.params.LoginParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @作者：大叔azhe
 * @api：详细描述
 * @创建时间：15:22 2023/4/11
 */
@Api(tags = "司机登录注销功能模块")
@RestController
@CrossOrigin
@RequestMapping("/driver")
public class DriverLoginController {

    @Autowired
    private DriverService driverService;

    @ApiOperation("司机登录")
    @RequestMapping("/driverlogin")
    @LogAnnotation(module = "司机模块", operator = "司机登录")
    public Result login(@RequestBody LoginParam loginParam, HttpServletRequest req) {
        return driverService.login(loginParam.getAccount(), loginParam.getPassword(),req);
    }

    @ApiOperation("司机注销")
    @RequestMapping("/driverlogout")
    @LogAnnotation(module = "司机模块", operator = "司机注销")
    public Result logout(HttpServletRequest req) {
        return driverService.logout(req);
    }


}
